package com.ubs.training.server.dao.impl.hbm;

import com.ubs.training.server.dao.RatingAgencyDao;
import com.ubs.training.server.dao.model.RatingAgency;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: xubuntu
 * Date: 8/27/12
 * Time: 5:49 AM
 * To change this template use File | Settings | File Templates.
 */
@Repository("hbmRatingAgencyDao")
public class HbmRatingAgencyDao implements RatingAgencyDao {


    private SessionFactory factory;

    private HibernateTemplate tpl;

    public SessionFactory getFactory() {
        return factory;
    }

    @Autowired
    public void setFactory(SessionFactory factory) {
        tpl = new HibernateTemplate(factory);
        this.factory = factory;
    }

    @Override
    public List<RatingAgency> getAll() {
        return tpl.loadAll(RatingAgency.class);
    }

    @Override
    public RatingAgency getById(int id) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public void add(RatingAgency ratingAgency) {
        tpl.save(ratingAgency);
    }

    @Override
    public void update(RatingAgency ratingAgency) {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    public void delete(RatingAgency ratingAgency) {
        //To change body of implemented methods use File | Settings | File Templates.
    }
}
